package com.example.rbacmanage.service.app.impl;

import com.example.rbacmanage.entity.app.PhotoFrame;
import com.example.rbacmanage.mapper.app.PhotoFrameMapper;
import com.example.rbacmanage.service.app.PhotoFrameService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PhotoFrameServiceImpl implements PhotoFrameService {
    @Autowired
    private PhotoFrameMapper photoFrameMapper;
    @Override
    public void save(PhotoFrame photoFrame) {
        photoFrameMapper.insert(photoFrame);
    }

    @Override
    public void remove(Long[] ids) {
        for (Long id : ids) {
            photoFrameMapper.del(id);
        }
    }

    @Override
    public void update(PhotoFrame photoFrame) {
        photoFrameMapper.update(photoFrame);
    }

    @Override
    public List<PhotoFrame> getAll(PhotoFrame photoFrame) {
        return photoFrameMapper.list(photoFrame);
    }

    @Override
    public PageInfo<PhotoFrame> getPage(PhotoFrame photoFrame) {
        return new PageInfo<>(getAll(photoFrame));
    }

    @Override
    public PhotoFrame getById(Long id) {
        return photoFrameMapper.queryOneById(id);
    }

    @Override
    public Integer getCount(PhotoFrame photoFrame) {
        return photoFrameMapper.count(photoFrame);
    }
}
